using System;
using System.Linq;
using System.Linq.Expressions;

namespace CommonPatterns.Caching
{
    public interface IRepository<TKey, TData>
    {
        /// <summary>
        /// Find an entity by its primary key
        /// We assume and enforce that every Entity
        /// is identified by an "Id" property of 
        /// type long
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        TData Find(TKey id);

        IQueryable<TData> Query();
        IQueryable<TData> Query(Expression<Func<TData, bool>> where);

        // Basic operations on an Entity
        void Delete(object target);
        void Save(object target);
        void Insert(object target);

        TData[] GetAll();
    }
}